package com.leetcode.sort.basic_sort;

import java.util.Random;

/**
 * @author Dennis Li
 * @date 2020/9/9 23:55
 */
public abstract class Sort {

    static Random random = new Random();

    public static boolean isSorted(int[] arr) {
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] < arr[i - 1])
                return false;
        }
        return true;
    }

    protected static void swap(int[] nums, int i, int j) {
        int temp = nums[i];
        nums[i] = nums[j];
        nums[j] = temp;
    }

    public static int[] generateArray(){
        return random.ints(10, 0, 10).toArray();
    }

    public static int[] generateArray(int n){
        return random.ints(n, Integer.MIN_VALUE, Integer.MAX_VALUE).toArray();
    }

}
